import { SET_USERINFO } from '../constant/userInfo'

export interface RootAction {
  type: string,
  userInfo: Iinfo
}

export interface Iinfo {
  username:string,
  token:string,
  role:string
}

//初始化人的列表
const initState: string = ''

export default function setTokenReducer(preState = initState, action:RootAction){
	const {type,userInfo} = action
	switch (type) {
		case SET_USERINFO: 
			return userInfo
		default:
			return preState
	}
}